package com.wxq.demo.dao;

import com.wxq.demo.pojo.Book;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;


@Repository
public interface BookDao extends JpaRepository<Book, Integer> {

    @Cacheable(value = "maxIdBook")
    @Query(value = "select * from book where id=(select max(id) from book)", nativeQuery = true)
    Book getMaxIdBook();

}
